package com.cango.framework.base.opt.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.cango.framework.base.opt.service.IDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cango.framework.base.entity.DictEntity;
import com.cango.framework.base.opt.dao.IDictDao;
import com.cango.framework.base.opt.service.IDictService;

/**
 *  数据字典service实现类<br> 
 * 〈功能详细描述〉
 *
 * @author weih
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
@Service("dictService")
public class DictServiceImpl implements IDictService {

    @Autowired
    IDictDao dictDao;

    @Override
    public List<DictEntity> getDictList(Integer dictType, boolean isAll) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("dictType", dictType);

        map.put("isAll", isAll);
        return dictDao.queryList("dict.queryDictByType", map);
    }

    @Override
    public List<DictEntity> getAllDictList(boolean isAll) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("isAll", isAll);
        return dictDao.queryList("dict.queryDictByType", map);
    }

    @Override
    public DictEntity getDictEntity(Integer dictCode) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("dictCode", dictCode);
        return dictDao.queryForObject("dict.queryDictByCode", map);
    }
}
